class CreateTree
  def create_tree(directories, parent = "..")
    directories.each_pair do|dir, files|
      path = File.join(parent,dir)
      Dir.mkdir path unless File.exist? path
      files.each do|filename|
        if filename.respond_to? :each_pair #is a subdirectory
          create_tree(filename, path)
        else
          File.open(File.join(path,filename),'w'){|f| f.write "#{filename}"}
        end
      end
    end
  end
end